function [CovBlocksNoisy] = addNoise(noise, CovBlocks),

if (length(noise)==1)
    noise = noise*ones(1,length(CovBlocks));
end

% We add for each block i symmetric Gaussian noise with variance i. 
CovBlocksNoisy = CovBlocks;
for k=1:length(CovBlocksNoisy),
    m = size(CovBlocksNoisy{k},1);
    A = 2*rand(m)-1;
    % Generate random positive semidefinite matrix
    [U,ignore] = eig((A+A')/2);
    S = U*diag(abs(rand(m,1)))*U';
    
    % Take into account level of noise
    s = noise(k)*rand(1,m);
    S = S.*(sqrt(s)'*sqrt(s));
    
    % Generate Gaussian noise with random covariance
    x = (S^(1/2)*randn(m,1000))';
    n = cov(x);
    CovBlocksNoisy{k} = n + CovBlocks{k};
end